
CREATE TABLE [dbo].[TranslationHistory](
	[IdTranslationHistory] [bigint] IDENTITY(1,1) NOT NULL,
	[IdUser] [bigint] NOT NULL,
	[IdLanguage] [varchar](2) NOT NULL,
	[Word] [varchar](256) NOT NULL,
	[DateSearch] [datetime2](7) NOT NULL,
	[Starred] [bit] NOT NULL,
 CONSTRAINT [PK_TranslationHistory] PRIMARY KEY CLUSTERED 
(
	[IdTranslationHistory] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

ALTER TABLE [dbo].[TranslationHistory] ADD  CONSTRAINT [DF_TranslationHistory_DateSearch]  DEFAULT (getdate()) FOR [DateSearch]

ALTER TABLE [dbo].[TranslationHistory] ADD  CONSTRAINT [DF_TranslationHistory_Starred]  DEFAULT ((0)) FOR [Starred]

ALTER TABLE [dbo].[TranslationHistory]  WITH CHECK ADD  CONSTRAINT [FK_TranslationHistory_Languages] FOREIGN KEY([IdLanguage])
REFERENCES [dbo].[Languages] ([IdLanguage])

ALTER TABLE [dbo].[TranslationHistory] CHECK CONSTRAINT [FK_TranslationHistory_Languages]

ALTER TABLE [dbo].[TranslationHistory]  WITH CHECK ADD  CONSTRAINT [FK_TranslationHistory_Users] FOREIGN KEY([IdUser])
REFERENCES [dbo].[Users] ([IdUser])

ALTER TABLE [dbo].[TranslationHistory] CHECK CONSTRAINT [FK_TranslationHistory_Users]

